<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>帖子列表</title>
</head>



<body>
<br>
   欢迎来到论坛，${username!""}，来看看今天有些什么新鲜事！<br>
   <form name="geMyArticleForm" action="/getMyArticle" method="POST">
	  <table>
	  
			<tr>
				<td colspan="2" align="center"><input type="submit" value="查看我的帖子" /></td>
			</tr>
		</table>
   </form>
	
<br>

  <#list articlelist as article> 
  帖子编号：${article.id}&nbsp;&nbsp;发帖人：${article.username}&nbsp;&nbsp;<!-- 回复的帖子编号：${article.parentId} --><br>
  主帖内容：${article.content} 
   	  <form name="editForm" action="/doEdit" method="POST">
	  <table>
			<tr>
				<td><input type="hidden" name="username" value="${article.username}" /></td>
				<td><input type="hidden" name="id" value="${article.id}" /></td>
				<td><input type="hidden" name="content" value="${article.content}" /></td>
				<td colspan="2" align="center"><input type="submit" value="修改该帖" /></td>
			</tr>
		</table>
	</form>
  该主贴所有回复帖：<br><#list article.child as article1>
  		回帖人：${article1.username} 回帖内容：${article1.content}<br>
  		 </#list>
  			
  
  
  	  <form name="replyForm" action="/doReply" method="POST">
	  <table>
			<tr>
				<td>添加回复：</td>
				<td><input type="text" name="content" value="" /></td>
			</tr>
			<td><input type="hidden" name="parentId" value="${article.id}" /></td>
			<tr>
				<td colspan="2" align="center"><input type="submit" value="发表回复贴" /><input
					type="reset" value="重新编辑回复贴"></td>
			</tr>
		</table>
	</form>
	
<br><br><br><br>
  </#list>
  
  
  <form name="publishForm" action="/doPublish" method="POST">
	  <table>
			<tr>
				<td>发帖内容：</td>
				<td><input type="text" name="content" value="" /></td>
			</tr>
			<tr>
				<td colspan="2" align="center"><input type="submit" value="发表主题帖" /><input
					type="reset" value="重新编辑主题帖"></td>
			</tr>
		</table>
   </form>
	
	 <form name="pageForm"  action="/articleList" method="POST">
	  <table>
			<tr>
			
				<!-- <input type="hidden" id="pageNum" name="pageNum" value="" />
				<input type="hidden"  name="pageSize" value="3" /></tr> -->
				
				<td>当前是第${pageNum!""}页  共${maxPage!""}页</td>  
			    <td>到第<input type="text" name="pageNum" value=""  style="width:12px;"/>页</td> 
			    <td><input type="submit" value="跳转" /></td>
			<!-- <td><input type="submit" name="" value="前一页"onclick="lastpage()" /></td>
			<td><input type="submit" name="" value="后一页" onclick="nextpage()"/></td> -->
			
			</tr>
		</table>
     </form>
     
     
     
     <td><a href="#" onclick="firstPage();">首页</a>&nbsp;&nbsp; 
	 <a href="#" onclick="nextPage();">下一页</a>&nbsp;&nbsp; 
	 <a href="#" onclick="lastPage();">上一页</a>&nbsp;&nbsp;
	 <a href="#" onclick="finalPage();">尾页</a></td>	
     
<!--这是用表单实现上一页下一页的方法 <script type="text/javascript">
var currentPage=${pageNum!};
function lastpage(){
	pageNum=currentPage-1;
    //$("#pageNum").val(pageNum);这是jquery的写法
	document.getElementById("pageNum").value=pageNum;
	//debugger;
	//console.log(a);
}
function nextpage(){
	currentPage++;
	pageNum=currentPage+1;
	document.getElementById("pageNum").value=pageNum;
}
</script> -->


<script type="text/javascript">
var currentPage=${pageNum!};
var maxPage=${maxPage!};
var formElement = document.getElementsByName("pageForm")[0];
function lastPage(){
	pageNum=currentPage-1;
	window.location="/articleList?pageNum="+pageNum;
}
function nextPage(){
	//debugger
	var pageNum=currentPage+1;
	//formElement.action="/articleList?pageNum="+pageNum;
	//pageNumElement.value = pageNum;
	window.location="/articleList?pageNum="+pageNum;
	//formElement.submit;
}
function finalPage(){
	window.location="/articleList?pageNum="+maxPage;
}
function firstPage(){
	window.location="/articleList?pageNum=1";
}



</script>

	
</body>
</html>